#pragma once
#include "DDefine.h"
#include "UIObject.h"
#include "DTextureManager.h"

class UIControl : public UIObject
{
private:
	LPDIRECT3DVERTEXBUFFER9		m_pVB;
	LPDIRECT3DINDEXBUFFER9		m_pIB;

	LPDIRECT3DTEXTURE9			m_pTexture;
	LPDIRECT3DTEXTURE9			m_pSeletTexture;


	LPDIRECT3DDEVICE9			m_pDevice;

	float m_posX;
	float m_posY;
	float m_width;
	float m_height;
	float m_minX;
	float m_minY;
	float m_maxX;
	float m_maxY;

	DWORD m_coler;

	bool m_bMouseOver;
	bool m_IsCreated;
	
	RECT m_rect;


public:
	
	inline LPDIRECT3DDEVICE9 GetDevice() const { m_pDevice; }
	inline float GetPosX() const	{ return m_posX;	}
	inline float GetPosY() const	{ return m_posY;	}

	inline float GetWidth() const	{ return m_width;	}
	inline float GetHeight() const	{ return m_height;	}

	inline float GetMinX() const	{ return m_minX;	}
	inline float GetMinY() const	{ return m_minY;	}

	inline float GetMaxX() const	{ return m_maxX;	}
	inline float GetMaxY() const	{ return m_maxY;	}

	inline bool	GetMouseOver() const { return m_bMouseOver; }
	inline RECT GetRect() const		{ return m_rect; }

	inline void SetColor(DWORD color) { m_coler = color; }
	inline void SetPos(float x, float y) { m_posX = x; m_posY = y; }
	inline void SetSize(float width, float height) { m_width = width; m_height = height; }
	inline void SetDevice(LPDIRECT3DDEVICE9 pDevice) { m_pDevice = pDevice; }

	virtual void InitVertexBuffer();
	virtual void Frame();
	virtual void Render();
	virtual void Run();
	virtual void ReleaseBuffer();
	virtual void FrameVertexBuffer();

public:
	UIControl(void);
	virtual ~UIControl(void);
};
